package com.aispeech.runner;

import com.aispeech.task.common.data.domain.Task;
import com.aispeech.task.common.exceptions.TaskException;
import com.aispeech.task.common.handler.TaskHandler;
import com.aispeech.task.common.handler.TaskManager;
import com.aispeech.task.lasr.LASRTaskHandler;
import lombok.extern.slf4j.Slf4j;

import java.util.HashMap;
import java.util.Map;

@Slf4j
public class Main {
    private static final String PRODUCT_ID = "1";

    public static void main(String[] args) throws TaskException {
        TaskManager manager = new LocalTaskManager();
        TaskHandler handler = new LASRTaskHandler();
        handler.initialize(manager, 2);

        handler.execute(mockTask());
    }

    private static Task mockTask() {
        Map<String, Object> request = new HashMap() {
            {
                put("from", "aispeech");
                put("task_type", 3);
                put("channel", 2);
            }
        };

        return Task.of(PRODUCT_ID, request);
    }
}
